package Music_Main;

import java.io.File;

import org.jaudiotagger.audio.AudioFileIO;
import org.jaudiotagger.audio.mp3.MP3AudioHeader;
import org.jaudiotagger.audio.mp3.MP3File;

import Lrcshow.LrcData;
import Music_View.music_view;
import model.Music;

public class playingThread {
	static long Time;
	public static void PlayingThread(long time){
		Time = time;
		Runnermousee runner=new Runnermousee();
		Thread thread = new Thread(runner);
		thread.start();
	}
	
}
class Runnermousee implements Runnable{
	int i=0;
	public void run() {System.out.println(LrcData.statements.size());
		while(true) {
			  VideoTime videoTime = new	VideoTime();
			  int runvalue = music_main.Newplaying.getJSliderPlayProgress().getValue();
			  videoTime.timeCalculate(playingThread.Time, runvalue);
			  String string1 = videoTime.getMinitueCurrent() + ":" + videoTime.getSecondCurrent();
			  String string2 = videoTime.getMinitueTotal() + ":" + videoTime.getSecondTotal();
			  if(i <LrcData.statements.size()-1&&(runvalue/1000)<=LrcData.statements.elementAt(i+1).getTime()&&(runvalue/1000)>=LrcData.statements.elementAt(i).getTime()) {
				  LrcData.printLrcDate(i);
				  System.out.println("i"+i);
				  i++;
			  }
			  music_view.getCurrentLabel().setText(string1);
			  music_view.getTotalLabel().setText(string2);
			  try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
				// TODO 自动生成的 catch 块
				e.printStackTrace();
			}
			  
		}
	}

	

}